"connect to mysql"
__author__ = "zhangyanqiang"

import pymysql
conn = pymysql.connect(host='localhost',user='root',password='hangzhou123',database='marketing')
cursor = conn.cursor()
##cursor.execute('create table if not exists user (id varchar(20) primary key, name varchar(20))')
cursor.execute('insert into user (id, name) values (%s, %s)', ['2', 'Michael'])
conn.commit()
cursor.close()
cursor = conn.cursor()
cursor.execute('select * from user where id = %s', ('1',))
values = cursor.fetchall()
print(values)
cursor.close()
conn.close()